package cn.edu.tju.elm.mapper;

import cn.edu.tju.elm.dto.CommentCreateDTO;
import cn.edu.tju.elm.dto.CommentResponseDTO;
import cn.edu.tju.elm.dto.CommentUpdateDTO;
import cn.edu.tju.elm.model.Comment;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * ClassName: CommentMapper
 * Package: cn.edu.tju.elm.mapper
 * Description: 评论实体和DTO转换器
 *
 * @Author System Generated
 * @Create 2025/10/30
 * @Version 1.0
 */
@Mapper(componentModel = "spring")
public interface CommentMapper {

    @Mapping(target = "order.id", source = "orderId")
    Comment createDtoToComment(CommentCreateDTO dto);

    @Mapping(source = "order.id", target = "orderId")
    @Mapping(source = "customer.id", target = "customerId")
    @Mapping(source = "customer.username", target = "customerName")
    @Mapping(source = "business.id", target = "businessId")
    @Mapping(source = "business.businessName", target = "businessName")
    CommentResponseDTO commentToResponseDTO(Comment comment);

    List<CommentResponseDTO> commentsToResponseDTOs(List<Comment> comments);

    Comment updateDtoToComment(CommentUpdateDTO dto);
}



